package appconfig

import "github.com/spf13/viper"

type Config struct {
	Mysql struct {
		User     string
		Pass     string
		Host     string
		Port     int
		Database string
	}
	Redis struct {
		Pass string
		Host string
		Port int
	}
	QiNiu struct {
		AccessKey string
		SecretKey string
		Bucket    string
		Rul       string
	}
}

var ConfigData Config

func Init() {
	viper.SetConfigFile("appconfig/config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		return
	}
	err = viper.Unmarshal(&ConfigData)
	if err != nil {
		return
	}
}
